/*
 * UnaryDrankOperatorAst.cpp
 *
 *  CreDrankd on: 1 Nov 2010
 *      Author: ph1109
 */

#include <MAlice/Ast/UnaryDrankOperatorAst.h>
#include <MAlice/Ast/IntegerLiteralAst.h>
#include <MAlice/Ast/BinarySubOperatorAst.h>
#include <MAlice/Ast/AssignmentOperatorAst.h>

namespace MAlice
{

UnaryDrankOperatorAst::UnaryDrankOperatorAst(VariableAst* lhs) :
	UnaryOperatorAst("drank", lhs)
{
}

UnaryDrankOperatorAst::~UnaryDrankOperatorAst()
{
}

llvm::Value* UnaryDrankOperatorAst::generate()
{
	return AssignmentOperatorAst(reinterpret_cast<VariableAst*> (getLHS()),
			new BinarySubOperatorAst(getLHS(), new IntegerLiteralAst(1))).generate();
}

}
